version: "3.1"
networks:
  proxynet:
    driver: bridge

volumes:
  local_postgres_data:

services:
  mongodb:
    build:
      context: .
      dockerfile: oldServer/compose/Dockerfile
    networks:
      - proxynet
    ports:
      - "27:27017"

  server_old:
    build:
      context: .
      dockerfile: oldServer/Dockerfile
    ports:
      - "8088:8088"
    networks:
      - proxynet
    depends_on:
      - mongodb

  postgresdb:
    image: postgres
    env_file:
      - newServer/app.env
    ports:
      - "5432:5432"
    networks:
      - proxynet
    volumes:
      - local_postgres_data:/var/lib/postgresql/data

  server_new:
    build:
      context: .
      dockerfile: newServer/Dockerfile
    ports:
      - "8001:8001"
    networks:
      - proxynet
    depends_on:
      - postgresdb

  nginx:
    build:
      context: .
      dockerfile: nginx/Dockerfile
    ports:
      - "80:81"
    depends_on:
      - server_new
      - server_old
    networks:
      - proxynet